package com.kai.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Scanner;

@RestController
public class AppController {

    @Autowired
    Register register;
    @Autowired
    Login login;


    boolean flag = true;
    Scanner sc = new Scanner(System.in);
    int input;

    @GetMapping("/app")
    public void menu()
    {
        do {

            System.out.println("****************************************");
            System.out.println("欢迎使用打印小工具");
            System.out.println("请选择>: ");
            System.out.println("1.注册");
            System.out.println("2.登录");
            System.out.println("0.退出");
            System.out.println("****************************************");

            input = sc.nextInt();

            switch (input) {
                case 1:
                    register.registered();
                    break;
                case 2:
                    login.logging();
                    break;
                case 0:
                    System.out.println("欢迎下次再来");
                    flag = false;
                    break;
                default:
                    System.out.println("请输入正确的选项");
            }

        }while (flag);
    }
    }

